﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using SksApp.Bussiness;

namespace SksApp
{

    public class Barkod
    {
        public int ID { get; set; }
        public string Barkodu { get; set; }
        public int StokID { get; set; }
        public string BirimAdi { get; set; }
        public decimal Katsayi { get; set; }
        public decimal NetAgirlik { get; set; }
        public override string ToString()
        {
            return Barkodu;
        }
    }

    public class BarkodTipi
    {
        public int ID { get; set; }
        public string Bayrak { get; set; }
        public int PluBaslangic { get; set; }
        public int PluUzunluk { get; set; }
        public int DataBaslangic { get; set; }
        public int DataUzunluk { get; set; }
        public byte Tip { get; set; }
        public int Carpan { get; set; }
        public int Bolen { get; set; }
    }

    public class Kasa
    {
        public int ID { get; set; }
        public int No { get; set; }
        public int MagazaID { get; set; }
        public int SablonID { get; set; }
        public string Aciklama { get; set; }
        public override string ToString()
        {
            return Aciklama;
        }
    }

    public class Kasiyer
    {
        public int ID { get; set; }
        public string Adi { get; set; }
        public string Sifresi { get; set; }
        public int SablonID { get; set; }
        public int MagazaID { get; set; }
        public int No { get; set; }
        public override string ToString()
        {
            return Adi;
        }
    }

    public class Magaza
    {
        public int ID { get; set; }
        public int No { get; set; }
        public string Adi { get; set; }
        public decimal FisLimiti { get; set; }
        public byte OnaySekli { get; set; }
        public override string ToString()
        {
            return Adi;
        }
    }

    public class BelgeSablonu
    {
        public int ID { get; set; }
        public byte Tip { get; set; }
        public byte[] Sablon { get; set; }
    }

    public class Stok
    {
        public int ID { get; set; }
        public string Kodu { get; set; }
        public string Adi { get; set; }
        public byte DovizCinsi { get; set; }
        public byte Cinsi { get; set; }
        public int VergiID { get; set; }
        public string Filtre1 { get; set; }
        public string Filtre2 { get; set; }
        public string Filtre3 { get; set; }
        public string Filtre4 { get; set; }
        public string Filtre5 { get; set; }
        public decimal IndirimOrani { get; set; }
        public decimal Fiyat1 { get; set; }
        public decimal Fiyat2 { get; set; }
        public decimal Fiyat3 { get; set; }
        public decimal Fiyat4 { get; set; }
        public decimal Fiyat5 { get; set; }
        public override string ToString()
        {
            return Adi;
        }
    }

    public class OdemeTipi
    {
        public int ID { get; set; }
        public int No { get; set; }
        public byte Tip { get; set; }
        public string Aciklama { get; set; }
        public string MuhasebeKodu { get; set; }
        public decimal KomisyonOrani { get; set; }
        public decimal IndirimOrani { get; set; }
        public int FiyatNo { get; set; }
        public override string ToString()
        {
            return Aciklama;
        }
    }

    public class OdemeHareketi
    {
        public int ID { get; set; }
        public int HareketID { get; set; }
        public int OdemeTipID { get; set; }
        public decimal OdemeTutari { get; set; }
    }

    public class Musteri
    {
        public int ID { get; set; }
        public string Kodu { get; set; }
        public string Adi { get; set; }
        public string VergiDairesi { get; set; }
        public string VergiNo { get; set; }
        public string Adres { get; set; }
        public int FiyatNo { get; set; }
        public decimal IndirimOrani { get; set; }
        public string KartNo { get; set; }
        public string Telefon { get; set; }
        public decimal Puan { get; set; }
    }

    public class VergiTanim
    {
        public int ID { get; set; }
        public byte No { get; set; }
        public string Aciklama { get; set; }
        public decimal Oran { get; set; }
        public int Sira { get; set; }
    }

    public class Tus
    {
        public int ID { get; set; }
        public int GroupNo { get; set; }
        public string Barkod { get; set; }
        public byte[] Image { get; set; }
        public string Adi { get; set; }
        public override string ToString()
        {
            return Adi;
        }
    }

    public class UrunGrup
    {
        public int ID { get; set; }
        public int No { get; set; }
        public string Adi { get; set; }
    }

    public class Hareket
    {
        public int HareketID { get; set; }
        public int Satir { get; set; }
        public int SipDbcNo { get; set; }
        public int SipRecNo { get; set; }
        public string StokKodu { get; set; }
        public decimal Miktar { get; set; }
        public decimal Fiyat { get; set; }
        public decimal Isk1Tutar { get; set; }
        public decimal Isk2Tutar { get; set; }
        public decimal Isk3Tutar { get; set; }
        public decimal Isk4Tutar { get; set; }
        public decimal Isk5Tutar { get; set; }
        public decimal BurutTutar { get; set; }
        public int KdvSira { get; set; }
        public decimal KdvOrani { get; set; }
        public decimal KdvTutari { get; set; }
        public int GirisDepoNo { get; set; }
        public int CikisDepoNo { get; set; }
        public string Barkod { get; set; }
        public int Vade { get; set; }
        public decimal PuanTutari { get; set; }
    }

    public class Evrak
    {
        public int ID { get; set; }
        public int RecNo { get; set; }
        public DateTime Tarih { get; set; }
        public string BelgeNo { get; set; }
        public string Seri { get; set; }
        public int Sira { get; set; }
        public byte EvrakCinsi { get; set; }
        public int CariID { get; set; }
        public string CariKodu { get; set; }
        public int KasaID { get; set; }
        public int KasiyerID { get; set; }
        public int Vade { get; set; }
        public decimal AraToplam { get; set; }
        public decimal IskontoToplam { get; set; }
        public decimal VergiToplam { get; set; }
        public decimal Toplam { get; set; }
        public int OdemeTip1ID { get; set; }
        public decimal OdemeTip1Tutar { get; set; }
        public int OdemeTip2ID { get; set; }
        public decimal OdemeTip2Tutar { get; set; }
        public int OdemeTip3ID { get; set; }
        public decimal OdemeTip3Tutar { get; set; }
        public decimal PuanTutari { get; set; }
        public decimal ParaUstu { get; set; }
    }

    public class SksEntity : DbContext
    {
        public DbSet<Barkod> Barkodlar { get; set; }
        public DbSet<BarkodTipi> BarkodTipleri { get; set; }
        public DbSet<Kasa> Kasalar { get; set; }
        public DbSet<Kasiyer> Kasiyerler { get; set; }
        public DbSet<Magaza> Magazalar { get; set; }
        public DbSet<BelgeSablonu> BelgeSablonlari { get; set; }
        public DbSet<Stok> Stoklar { get; set; }
        public DbSet<OdemeTipi> OdemeTipleri { get; set; }
        public DbSet<OdemeHareketi> OdemeHareketleri { get; set; }
        public DbSet<Musteri> Musteriler { get; set; }
        public DbSet<VergiTanim> VergiOranlari { get; set; }
        public DbSet<UrunGrup> UrunGruplari { get; set; }
        public DbSet<Tus> Tuslar { get; set; }
        public DbSet<Evrak> Evraklar { get; set; }
        public DbSet<Hareket> HareketBilgileri { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {

            modelBuilder.Entity<Evrak>().Property(c => c.AraToplam).HasColumnType("Money");
            modelBuilder.Entity<Evrak>().Property(c => c.IskontoToplam).HasColumnType("Money");
            modelBuilder.Entity<Evrak>().Property(c => c.VergiToplam).HasColumnType("Money");
            modelBuilder.Entity<Evrak>().Property(c => c.Toplam).HasColumnType("Money");
            modelBuilder.Entity<Evrak>().ToTable("EvrakBilgileri");

            modelBuilder.Entity<Hareket>().Property(c => c.Miktar).HasColumnType("Money");
            modelBuilder.Entity<Hareket>().Property(c => c.Fiyat).HasColumnType("Money");
            modelBuilder.Entity<Hareket>().Property(c => c.BurutTutar).HasColumnType("Money");
            modelBuilder.Entity<Hareket>().Property(c => c.Isk1Tutar).HasColumnType("Money");
            modelBuilder.Entity<Hareket>().Property(c => c.Isk2Tutar).HasColumnType("Money");
            modelBuilder.Entity<Hareket>().Property(c => c.Isk3Tutar).HasColumnType("Money");
            modelBuilder.Entity<Hareket>().Property(c => c.Isk4Tutar).HasColumnType("Money");
            modelBuilder.Entity<Hareket>().Property(c => c.Isk5Tutar).HasColumnType("Money");
            modelBuilder.Entity<Hareket>().Property(c => c.KdvTutari).HasColumnType("Money");
            modelBuilder.Entity<Hareket>().ToTable("HareketBilgileri");

            modelBuilder.Entity<Barkod>().Property(c => c.Katsayi).HasColumnType("Money");
            modelBuilder.Entity<Barkod>().Property(c => c.NetAgirlik).HasColumnType("Money");
            modelBuilder.Entity<Barkod>().ToTable("Barkod");

            modelBuilder.Entity<BarkodTipi>().ToTable("BarkodTipi");
            modelBuilder.Entity<Kasa>().ToTable("Kasa");
            modelBuilder.Entity<Kasiyer>().ToTable("Kasiyer");

            modelBuilder.Entity<Magaza>().Property(c => c.FisLimiti).HasColumnType("Money");
            modelBuilder.Entity<Magaza>().ToTable("Magaza");

            modelBuilder.Entity<BelgeSablonu>().ToTable("BelgeSablonu");
            modelBuilder.Entity<BelgeSablonu>().Property(x => x.Sablon).HasColumnType("image");
            modelBuilder.Entity<BelgeSablonu>().Property(x => x.Sablon).HasMaxLength(8000);


            modelBuilder.Entity<Stok>().Property(c => c.IndirimOrani).HasColumnType("Money");
            modelBuilder.Entity<Stok>().Property(c => c.Fiyat1).HasColumnType("Money");
            modelBuilder.Entity<Stok>().Property(c => c.Fiyat2).HasColumnType("Money");
            modelBuilder.Entity<Stok>().Property(c => c.Fiyat3).HasColumnType("Money");
            modelBuilder.Entity<Stok>().Property(c => c.Fiyat4).HasColumnType("Money");
            modelBuilder.Entity<Stok>().Property(c => c.Fiyat5).HasColumnType("Money");
            modelBuilder.Entity<Stok>().ToTable("Stok");

            modelBuilder.Entity<OdemeTipi>().Property(c => c.KomisyonOrani).HasColumnType("Money");
            modelBuilder.Entity<OdemeTipi>().Property(c => c.IndirimOrani).HasColumnType("Money");
            modelBuilder.Entity<OdemeTipi>().ToTable("OdemeTipi");

            modelBuilder.Entity<OdemeHareketi>().Property(c => c.OdemeTutari).HasColumnType("Money");
            modelBuilder.Entity<OdemeHareketi>().ToTable("OdemeHareketi");

            modelBuilder.Entity<Musteri>().Property(c => c.IndirimOrani).HasColumnType("Money");
            modelBuilder.Entity<Musteri>().ToTable("Musteri");

            modelBuilder.Entity<VergiTanim>().Property(c => c.Oran).HasColumnType("Money");
            modelBuilder.Entity<VergiTanim>().ToTable("VergiTanimlari");

            modelBuilder.Entity<UrunGrup>().ToTable("UrunGruplari");
            modelBuilder.Entity<Tus>().ToTable("TusTanimlari");

        }

    }
}
